﻿Public Class frmOptions
    Private Sub frmOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Icon = My.Resources.Main

        LoadSettings()
    End Sub

    Private Sub LoadSettings()
        pbWaveform1.BackColor = My.Settings.WaveformColor1
        pbWaveform2.BackColor = My.Settings.WaveformColor2
        pbWaveform3.BackColor = My.Settings.WaveformColor3
        pbWaveform4.BackColor = My.Settings.WaveformColor4
        chkDrawTrackBoundaries.Checked = My.Settings.DrawTrackBoundaries
        chkEjectCDAfterProcessing.Checked = My.Settings.EjectCDAfterProcessing
        chkDoNotDeleteWAVFile.Checked = My.Settings.DoNotDeleteWave
        If My.Settings.WaveformSize.Width > 0 Then txtWaveformWidth.Value = My.Settings.WaveformSize.Width
        If My.Settings.WaveformSize.Height > 0 Then txtWaveformHeight.Value = My.Settings.WaveformSize.Height

    End Sub

    Private Sub pbWaveform1_Click(sender As Object, e As EventArgs) Handles pbWaveform1.Click
        dlgColors.Color = pbWaveform1.BackColor

        If dlgColors.ShowDialog = DialogResult.OK Then pbWaveform1.BackColor = dlgColors.Color

    End Sub

    Private Sub pbWaveform2_Click(sender As Object, e As EventArgs) Handles pbWaveform2.Click
        dlgColors.Color = pbWaveform2.BackColor

        If dlgColors.ShowDialog = DialogResult.OK Then pbWaveform2.BackColor = dlgColors.Color

    End Sub

    Private Sub pbWaveform3_Click(sender As Object, e As EventArgs) Handles pbWaveform3.Click
        dlgColors.Color = pbWaveform3.BackColor

        If dlgColors.ShowDialog = DialogResult.OK Then pbWaveform3.BackColor = dlgColors.Color

    End Sub

    Private Sub pbWaveform4_Click(sender As Object, e As EventArgs) Handles pbWaveform4.Click
        dlgColors.Color = pbWaveform4.BackColor

        If dlgColors.ShowDialog = DialogResult.OK Then pbWaveform4.BackColor = dlgColors.Color

    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
        pbWaveform1_Click(sender, e)
    End Sub

    Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
        pbWaveform2_Click(sender, e)

    End Sub

    Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
        pbWaveform3_Click(sender, e)

    End Sub

    Private Sub Label4_Click(sender As Object, e As EventArgs) Handles Label4.Click
        pbWaveform4_Click(sender, e)

    End Sub

    Private Sub cmdSave_Click(sender As Object, e As EventArgs) Handles cmdSave.Click
        With My.Settings
            .WaveformColor1 = pbWaveform1.BackColor
            .WaveformColor2 = pbWaveform2.BackColor
            .WaveformColor3 = pbWaveform3.BackColor
            .WaveformColor4 = pbWaveform4.BackColor
            .DrawTrackBoundaries = chkDrawTrackBoundaries.Checked
            .EjectCDAfterProcessing = chkEjectCDAfterProcessing.Checked
            .DoNotDeleteWave = chkDoNotDeleteWAVFile.Checked
            .WaveformSize = New Size(CInt(txtWaveformWidth.Value), CInt(txtWaveformHeight.Value))
            .Save()
        End With

        Me.Close()

    End Sub

    Private Sub cmdCancel_Click(sender As Object, e As EventArgs) Handles cmdCancel.Click
        Me.Close()

    End Sub

End Class